function insert_conditioning()
%
% for each record in the control list, find "timing_cond" protocol
% and insert the records that correspond.
% -- unless they already are present.
%
global CONTROL DFILE NOTEFILE

fn={CONTROL.filename}';
[fnu, i, j]=unique(fn); % get uniques
is = sort(i);
for k = 1: length(is);
   i = is(k);
   % open the file, read the note information
   truefile  = append_backslash(CONTROL(i).path);
   truefile = [truefile CONTROL(i).filename];
   err=datac('open', truefile);
   if(err == 1)
      QueMessage(sprintf('insert_conditioning: unable to open %s\n', truefile), 1);
      return;
   end;
   % now in the note/protocol, find "timing_cond".
   NOTEFILE = datac('getnote'); % read the notefile and make it current
   to_control(DFILE, NOTEFILE, 'timing_cond', 'last');
	QueMessage(sprintf('inserting file %s', truefile));
end;
QueMessage('Insert-conditioning: Complete');